<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改产值费用率')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-expenseReport-edit">
        <input th:value="${obj.id}" id="id" name="id" class="form-control" type="hidden" />
        <h4 class="form-header h4">基本信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label">工程公司：</label>
            <div class="col-sm-8">
                <select name="compId" id="compId" class="form-control noselect2">
                    <option value="">请选择</option>
                    <option th:each="pro:${userComp}"
                            th:selected="${obj.compId==pro.compId}"
                            th:value="${pro.compId}"
                            th:text="${pro.compName}"></option>

                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">职能部门/项目名称：</label>
            <div class="col-sm-8">

                <input th:value="${obj.depOrProName}" id="depOrProName" name="depOrProName" class="form-control" type="text"
                       placeholder="请输入职能部门/项目名称">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">费用类型：</label>
            <div class="col-sm-8">
                <select name="valueType" id="valueType" class="form-control noselect2">
                    <option value="">请选择</option>
                    <option value="1" th:selected="${1==obj.valueType}">项目</option>
                    <option value="2" th:selected="${2==obj.valueType}">职能部门</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">产值费用率：</label>
            <div class="col-sm-8">
                <input th:value="${obj.outputCostRate}" name="outputCostRate" id="outputCostRate" class="form-control" type="text"
                       placeholder="请输入产值费用率">
            </div>
        </div>


    </form>
    <th:block th:include="include :: footer"/>
    <th:block th:include="include :: datetimepicker-js"/>
    <th:block th:include="include :: select2-js"/>
    <script type="text/javascript">
        var prefix = ctx + "expenseReport";
        var data;
        function submitHandler() {
            data = {
                "id": $("#id").val(),
                "compId": $("#compId").val(),
                "depOrProName": $("#depOrProName").val(),
                "outputCostRate": $("#outputCostRate").val(),
                "valueType": $("#valueType").val(),
            }
            if ($("#compId").val() == "" || $("#depOrProName").val() == "" || $("#valueType").val() == "" || $("#outputCostRate").val() == "") {
                alert("请检查工程公司、项目名称、费用类型和产值费用率是否填写！");
            } else {
                $.operate.save(prefix + "/edit", data);
            }
        }
    </script>
</div>
</body>
</html>